﻿using System;
using System.Threading;
using System.Windows.Forms;

namespace Thread_Study
{
    public partial class Form1 : Form
    {
        private delegate void wtTxt(string str);//委托
        private Thread t;//子线程
        private string p = "abc";
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }

        private void button1_Click(object sender, EventArgs e)
        {
            t = new Thread(sinvoke);//创建子线程
            t.Start();//启动子线程
            p += "a";
        }
        private void sinvoke()
        {
            this.Invoke(new wtTxt(setTxt),p);
        }
        private void setTxt(string str)
        {
            tb.Text = str;
        }
    }
}
